﻿using System;
using System.Collections.Generic;
using FitAutomation2;

namespace FitAutomation
{
	public static class FitAutomationFacade
	{
		/// <summary>
		/// Add one another existing hosts to controll by current FitAutomationFacade
		/// </summary>
		public static void InjectHost(params string[] hostNames)
		{
			foreach (var hostName in hostNames)
			{
				InjectHost(hostName);
			}
		}

		/// <summary>
		/// Add one another existing host to controll by current FitAutomationFacade
		/// </summary>
		public static void InjectHost(string hostName)
		{

		}

		/// <summary>
		/// Add one another existing process to controll by current FitAutomationFacade.
		/// If host is unknown - InjectHost called implicitly.
		/// If processIdentity does not exixts - exception is thrown.
		/// </summary>
		public static void InjectProcess(string hostName, string processIdentity)
		{

		}

		/// <summary>
		/// Get list of all hosts controlled by current FitAutomationFacade
		/// </summary>
		public static IEnumerable<IHostAccessor> Hosts
		{
			get
			{
				return null;
			}
		}

		/// <summary>
		/// Get list of all processes controlled by current FitAutomationFacade
		/// </summary>
		public static IEnumerable<IProcessAccessor> Processes
		{
			get
			{
				return null;
			}
		}

		public static void RegisterProcess()
		{
			RegisterProcess(null);
		}

		/// <summary>
		/// Register process in MasterHostProceess
		/// </summary>
		public static void RegisterProcess(string id)
		{

		}

		/// <summary>
		/// Call specified code in any process and host
		/// </summary>
		/// <typeparam name="TClass">Class containing a code to execute</typeparam>
		/// <param name="host">host name for code execution. Leave blank or 'localhost' to access current host.</param>
		/// <param name="processIdentity">process identity at which code is executed. Specify any registered process or leave null for executing in MasterHostProceess</param>
		/// <returns></returns>
		public static IObjectAccessor Call<TClass>(string host, string processIdentity)
		{
			return Call<TClass>(host, processIdentity, default(string));
		}

		/// <summary>
		/// Call specified code in any process and host
		/// </summary>
		/// <typeparam name="TClass">Class containing a code to execute</typeparam>
		/// <param name="host">host name for code execution. Leave blank or 'localhost' to access current host.</param>
		/// <param name="processIdentity">process identity at which code is executed. Specify any registered process or leave null for executing in MasterHostProceess</param>
		/// <param name="objectIdentity">object name. If object with this name does not exists - create a new one. Leave blank to use class name</param>
		/// <returns></returns>
		public static IObjectAccessor Call<TClass>(string host, string processIdentity, string objectIdentity)
		{
			return null;
		}

		public static IObjectAccessor Call(string host, string processIdentity, string objectIdentity)
		{
			return null;
		}

		public static void Call(string host, string processIdentity, Action act)
		{

		}

		public static void Call<TIn>(string host, string processIdentity, Action<TIn> act)
		{

		}

		public static TOut Call<TOut>(string host, string processIdentity, Func<TOut> act)
		{
			return default(TOut);
		}

		public static TOut Call<TIn, TOut>(string host, string processIdentity, Action<TIn, TOut> act)
		{
			return default(TOut);
		}
	}

}
